package com.cebbank.yyi.springbootapp.jingtang.service.impl;

import com.cebbank.yyi.springbootapp.jingtang.entity.RcDocManagerDocRegulations;
import com.cebbank.yyi.springbootapp.jingtang.dao.RcDocManagerDocRegulationsDao;
import com.cebbank.yyi.springbootapp.jingtang.service.RcDocManagerDocRegulationsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 规章制度文件附件(RcDocManagerDocRegulations)表服务实现类
 *
 * @author makejava
 * @since 2024-08-22 10:34:43
 */
@Service("rcDocManagerDocRegulationsService")
public class RcDocManagerDocRegulationsServiceImpl implements RcDocManagerDocRegulationsService {
    @Resource
    private RcDocManagerDocRegulationsDao rcDocManagerDocRegulationsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RcDocManagerDocRegulations queryById(String id) {
        return this.rcDocManagerDocRegulationsDao.queryById(id);
    }

//    /**
//     * 分页查询
//     *
//     * @param rcDocManagerDocRegulations 筛选条件
//     * @param pageRequest                分页对象
//     * @return 查询结果
//     */
//    @Override
//    public Page<RcDocManagerDocRegulations> queryByPage(RcDocManagerDocRegulations rcDocManagerDocRegulations, PageRequest pageRequest) {
//        long total = this.rcDocManagerDocRegulationsDao.count(rcDocManagerDocRegulations);
//        return new PageImpl<>(this.rcDocManagerDocRegulationsDao.queryAllByLimit(rcDocManagerDocRegulations, pageRequest), pageRequest, total);
//    }

    /**
     * 新增数据
     *
     * @param rcDocManagerDocRegulations 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocManagerDocRegulations insert(RcDocManagerDocRegulations rcDocManagerDocRegulations) {
        this.rcDocManagerDocRegulationsDao.insert(rcDocManagerDocRegulations);
        return rcDocManagerDocRegulations;
    }

    /**
     * 修改数据
     *
     * @param rcDocManagerDocRegulations 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocManagerDocRegulations update(RcDocManagerDocRegulations rcDocManagerDocRegulations) {
        this.rcDocManagerDocRegulationsDao.update(rcDocManagerDocRegulations);
        return this.queryById(rcDocManagerDocRegulations.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.rcDocManagerDocRegulationsDao.deleteById(id) > 0;
    }
}
